package com.basic.nio.channel;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;

/**
 * @Author: wisdom
 * @Date: 2024/4/2  9:01 PM
 * @Description:
 */
public class SocketChannelDemo {

    public static void main(String[] args) throws IOException {
        //连接服务端方式一
        SocketChannel channel = SocketChannel.open(new InetSocketAddress("127.0.0.1", 9999));

        //连接服务端方式二
        SocketChannel channel2 = SocketChannel.open();
        channel2.connect(new InetSocketAddress("127.0.0.1", 9999));
    }
}
